package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.Merchant;
import com.red.star.wechat.data.entity.MerchantCategory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface MerchantCategoryMapper extends MyMapper<MerchantCategory> {

    @Select(value = "select * from t_merchant_category where merchant_id=#{merchantId} and type=0")
    List<MerchantCategory> findByMerchantId(Integer merchantId);

    @Update(value = "update t_merchant_category set category=#{category} where merchant_id=#{merchantId} and type=0")
    int updateByMerchantId(MerchantCategory merchantCategory);

    int updateList(List<MerchantCategory> updateList);

    List<Merchant> selectByShopIds(@Param("shopIds") List<Integer> shopIds);

    @Delete(value = "delete from t_merchant_category where merchant_id=#{merchantId}")
    int deleteByMerchantId(Integer merchantId);

    int deleteListByMerchantId (@Param("deleteMerchantIds")List<Integer> deleteMerchantIds);

    @Select(value = "select * from t_merchant_category where (type=0 or type=1)")
    List<MerchantCategory> selectMerchantCategory();

}
